package utils;

import java.util.Random;
import java.util.Scanner;

public class Utils {
   //键盘输入
    public static int setInput() {
        //数字输入
        Scanner scanner=new Scanner(System.in);
        int a=0;
        try {    a=scanner.nextInt();
            if(a==0||a>9){
                System.out.println("请重新输入：");
                setInput();
            }
        } catch (Exception e) {
            //e.printStackTrace();
            System.out.println("请重新输入：");
            setInput();
        }
        return a;
    }
    public static String  setImport() {
        //字符串输入
        Scanner sc=new Scanner(System.in);
        String a=sc.next();
        return a;
    }
    //生成电话号码
    public static String createCardNumber() {
        Random random=new Random();
        String start="139";
        for(int j=0;j<8;j++){
            String endNumbers=String.valueOf(random.nextInt(9));
            start=start+endNumbers;
        }
        return  start;
    }
}
